Move opentelemetry_excluded_urls onto OpenTelemetryConfig; pin sibling-path exclusions#132
Merged
Merged
Conversation
Pins the genuine cross-instrument reads in _build_excluded_urls (prometheus_metrics_path, health_checks_path + the generate_health_check_spans conditional) so a rename or policy regression fails loudly. Characterizes existing behavior; no production change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The field was OTel's own setting but declared three times on the framework configs and read via getattr. Move it to OpenTelemetryConfig (one declaration, typed access in _build_excluded_urls). Inherited by all OTel-composing configs including FreeConfig (inert there). The prometheus/health getattrs stay — those are genuine optional siblings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Resolves the proportionate slice of architecture-review candidate 4 (OTel's stringly-typed cross-config reads).
opentelemetry_excluded_urlsontoOpenTelemetryConfig. It was OTel's own setting but declared three times on the framework configs (FastAPIConfig/LitestarConfig/FastStreamConfig) and never onOpenTelemetryConfig— which forced_build_excluded_urlsto read it viagetattr. Now one declaration, typed access. Inherited by every OTel-composing config (incl.FreeConfig, where it's inert).prometheus_metrics_path/health_checks_pathbelong to other instruments and are optionally absent (OTel runs inFreeConfig), so their defensivegetattr(..., None)stays — but a new test now asserts the metrics path is always excluded and the health path is excluded iffopentelemetry_generate_health_check_spans=False. A rename or policy regression now fails loudly; previously it was silent.Why
The four getattrs in
_build_excluded_urlsare two different things. One is a misplaced own-field (fix it); three are genuine optional siblings (keep the defensive read, but test it). Full reasoning, and why the "contribution mechanism" refactor was rejected (worsens locality, fails the deletion test), in the change bundle.Not done (deliberately)
_build_excluded_urlskeeps the exclusion policy in one readable method.pyroscope_endpointgetattr (line 174) left as-is — it's a span-processor decision, not part of URL exclusion.Verification
201 passed, 100% coverage;just lintclean (ruff+ty). Spot-checkedFreeConfig(opentelemetry_excluded_urls=["/x"])constructs (field now inherited).🤖 Generated with Claude Code